<?php
namespace Model;

use Zend\Db\Adapter\Adapter;
use Zend\Db\Adapter\Platform\Mysql;
use Zend\Db\Adapter\Platform\Sql92;
use Zend\Db\Sql\Predicate\Like;
use Zend\Db\Sql\Predicate\Operator;
use Zend\Db\Sql\Select;
use Zend\InputFilter\InputFilter;

class MenuTable extends AbstractTable implements LanguageAwareInterface
{
    /**
     * @var string
     */
    private  $_lang;

    /**
     * @param $id
     * @return Menu
     */
    public function getMenu($id){
       return $this->getById($id);
    }

    /**
     * @param $name
     * @return Menu
     */
    public function getMenuByName($name)
    {
       return $this->getByColumn('name', $name)->current();
    }

    /**
     * @param $code
     * @return Menu
     */
    public function getMenuByCode($code)
    {
        return $this->getByColumn('code', $code)->current();
    }

    /**
     * @return InputFilter
     */
    public function getInputFilter()
    {
        $filter = new InputFilter();
        return $filter;
    }

    public function getLang()
    {
        return $this->_lang;
    }

    public function setLang($lang)
    {
        $this->_lang = $lang;
    }


    public function getAll(){
        return $this->getTableGateway()->select(array('lang'=>$this->_lang));
    }

}